package com.fenxiangle.yueding.feature.login.model;

import com.fenxiangle.yueding.entity.bo.LoginPram;
import com.fenxiangle.yueding.feature.login.dependencies.login.DaggerLoginModelComponent;
import com.fenxiangle.yueding.framework.api.ApiLib;
import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.fenxiangle.yueding.feature.login.contract.LoginContract;
import com.fenxiangle.yueding.framework.api.UserApi;
import javax.inject.Inject;

import io.reactivex.Observable;

public class LoginModel implements LoginContract.Model {

    @Inject
    UserApi api;


    @Inject
    public LoginModel() {
        DaggerLoginModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }



    @Override
    public Observable<UserInfoBo> userThirdLogin(LoginPram registerBo) {
        return api.userThirdLogin(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<UserInfoBo> userLogin(LoginPram registerBo) {
        return api.userLogin(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<UserInfoBo> bindPhone(LoginPram registerBo) {
        return api.bindPhone(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }


    @Override
    public Observable<LoginPram> sendCode(LoginPram registerBo) {
        return api.sendCode(registerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
